<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>金字塔</title>
    <style>
        body{
            font-family: Aharoni;
        }
    </style>
</head>
<body>
    <script>
        var num=prompt("请输入金字塔层数");
        for(var i=1;i<num;i++){
            for(var j=0;j<num-i;j++){
                document.write("&nbsp");
            }
            for(var k=0;k<i*2-1;k++){
                document.write("*");
            }
            document.write("<br>");
        }
    </script>
</body>
</html>